import { takeEvery, put } from 'redux-saga/effects'
import { GET_MY_LIST } from './actionTypes'
import { getMyListAction } from './actionCreatores'
import axios from 'axios'

// generator函数
function* mySaga() {
    //等待捕获action
    yield takeEvery(GET_MY_LIST, getList)
}

function* getList() {
    console.log("123");
    const res = yield axios.get('https://www.fastmock.site/mock/6ff52d018330d0650bed38718fde63b1/redux/getList');
    const action = getMyListAction(res.data);
    yield put(action);

}
export default mySaga;